#ifndef _LOG_H_
#define _LOG_H_

#include <iostream>
#include <fstream>
#include <pthread.h>
#include <cstdlib>
using namespace std;

enum LogLevel {
    LOG_LEVEL_DEBUG,
    LOG_LEVEL_INFO,
    LOG_LEVEL_WARNING,
    LOG_LEVEL_ERROR,
    LOG_LEVEL_FATAL,
};

class Logger {
    public:
        Logger(string filename, enum LogLevel lel = LOG_LEVEL_DEBUG);
        virtual ~Logger();
        pthread_mutex_t log_lock;
        ofstream ofile;
        enum LogLevel level;
        void log(string msg, enum LogLevel lel = LOG_LEVEL_INFO);
};

extern Logger logger;

#endif

